package com.wealth.cart.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.wealth.commodity.entity.Goods;
import com.wealth.merchant.entity.Merchant;

/**
 * 购物车明细
 * 
 * @author zjw
 */

@Entity
@Table(name = "t_cart_item")
public class CartItem implements Serializable{
 
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Long id;
	private Goods goods;
	private Cart cart;
	private Double price;
	private Integer amount;
	private Date createtime;
	private Integer status;
	private Merchant merchant;

	/* ---------------- method ----------------*/
	
	public CartItem() {}
	
	public CartItem(Long id){
		this.id = id;
	}

	/* ---------------- getter/setter ----------------*/
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name = "goods_id")
	public Goods getGoods() {
		return goods;
	}

	public void setGoods(Goods goods) {
		this.goods = goods;
	}

	
	@Column(name="amount")
	public Integer getAmount() {
		return amount;
	}

	public void setAmount(Integer amount) {
		this.amount = amount;
	}
	
	@Column(name="price")
	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	@Column(name="create_time")
	public Date getCreatetime() {
		return createtime;
	}

	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}
	
	@Column(name="status")
	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

 
	@ManyToOne
	@JoinColumn(name="cart_id")
	public Cart getCart() {
		return cart;
	}

	public void setCart(Cart cart) {
		this.cart = cart;
	}

	@ManyToOne
	@JoinColumn(name="merchant_id")
	public Merchant getMerchant() {
		return merchant;
	}

	public void setMerchant(Merchant merchant) {
		this.merchant = merchant;
	}
 
}
